using Webshop20.Domain.Shared.Products.Core;
using System;

namespace Webshop20.Domain.Catalog.Core
{
    [Serializable]
    public class ShoppingCartItem : Item
    {
        public virtual int Quantity { get; private set; }
        public virtual DateTime AddedAt { get; private set; }
        public virtual Product Product { get; private set; }

        public ShoppingCartItem(int quantity, Product product, DateTime addedAt) : base(product)
        {
            Quantity = quantity;
            AddedAt = addedAt;
            Product = product;
        }

        public ShoppingCartItem()
        {}

        public virtual decimal Calculate(ISalesTax salesTax, DateTime calculationDate)
        {
            return Product.CalculateTotal(salesTax, calculationDate)*Quantity;
        }


    }
}